package IO;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/*文件复制：将一个文件的数据复制到类一个文件中*/
public class CopyDemo {
    public static void main(String[] args)throws Exception {

        FileInputStream fis = new FileInputStream("123.png");
        FileOutputStream fos = new FileOutputStream("123_cop.png");
        long at = System.currentTimeMillis();
        int d;
        while ((d=fis.read())!=-1){
            fos.write(d);
        }
        long ac = System.currentTimeMillis();
        System.out.println("复制完毕"+(ac-at));
        fis.close();
        fos.close();
    }
}
